/* "To Denounce, or Not To Denounce:Survey Experiment on Diplomatic Quarrels,"
Shoko Kohama, Atsushi Tago, Kazunori Inamasu */

/* Change the delimiter */
#delimit ;

/* Setting */
set more off; 
set scheme s1mono;
set graphics off;

/* Load the data */
use Political_Communication_Replication.dta, clear;

/*******************************/
/******  Data Cleaning  ********/
/*******************************/


label var q01_1 "Practice1";
label var q01_2 "Practice2";
label var q02a "Support A";
label var q02b "Support B";
recode q02a (1=4)(2=3)(3=2)(4=1)(5=.)(6=.);
recode q02b (1=4)(2=3)(3=2)(4=1)(5=.)(6=.);
recode q03_01 (1=.)(2=1)(3=2)(4=3)(5=4);
recode q03_02 (1=.)(2=1)(3=2)(4=3)(5=4);
recode q03_03 (1=.)(2=1)(3=2)(4=3)(5=4);
recode q03_04 (1=.)(2=1)(3=2)(4=3)(5=4);
recode q03_05 (1=.)(2=1)(3=2)(4=3)(5=4);
recode q03_06 (1=.)(2=1)(3=2)(4=3)(5=4);
recode q03_07 (1=.)(2=1)(3=2)(4=3)(5=4);
recode q03_08 (1=.)(2=1)(3=2)(4=3)(5=4);
recode q03_09 (1=.)(2=1)(3=2)(4=3)(5=4);
recode q03_10 (1=.)(2=1)(3=2)(4=3)(5=4);
recode q03_11 (1=.)(2=1)(3=2)(4=3)(5=4);
recode q03_12 (1=.)(2=1)(3=2)(4=3)(5=4);
recode q03_13 (1=.)(2=1)(3=2)(4=3)(5=4);
label var q05_1 "Anonymous AB";
label var q06 "Actual pairs";
label define q06label 
            1 "Japan&S.Korea"
            2 "Japan&Russia"
            3 "Japan&China"
            4 "S.Korea&China"
            5 "S.Korea&Russia"
            6 "China&Russia"
			7 "DK";
label value q06 q06label;
label var q07 "Birth year";
recode q07  (1985/1994 = 0 "20-29")
			(1975/1984 = 1 "30-39")
			(1965/1974 = 2 "40-49")
			(1955/1964 = 3 "50-59")
			(1944/1954 = 4 "60-70"),gen(age);
label var age "Age";
label var q08 "Gender";
label define q08label 
            1 "Male"
            2 "Female";
label value q08 q08label;
label var q10 "Education";
recode q10 (1 2 3 4 5 6 = 0 "Not college graduate")
		   (7 8 9 = 1 "College graduate"),gen(college);
label var college "Education";
label var q11 "Income (mil yen)";
label define q11label 
            1 "less than 3.5"
            2 "3.5-4.8"
            3 "4.8-6.3"
            4 "6.3-8.3"
            5 "8.3-";
label value q11 q11label;
label var q12 "Ideology";
destring q12, replace;
recode q12 (11=.);
recode q12 (0/2 = 0 "Liberal")
		   (3/7 = 1 "Moderate")
		   (8/10 = 2 "Conservative"),gen(ideology);
label var ideology "Ideology";
label var q13_1 "TV news";
recode q13_1 (6=.)(7=.);
label define q13_1label 
            1 "Not at all"
            2 "Once a week"
            3 "2 or 3 days a week"
            4 "4 or 5 days a week"
            5 "Almost everyday";
label value q13_1 q13_1label;
label var q13_2 "Newspaper";
recode q13_2 (6=.)(7=.);
label define q13_2label 
            1 "Not at all"
            2 "Once a week"
            3 "2 or 3 days a week"
            4 "4 or 5 days a week"
            5 "Almost everyday";
label value q13_2 q13_2label;
label var q13_3_1 "Online news";
recode q13_1 (6=.)(7=.);
recode q13_2 (6=.)(7=.);
recode q13_3_1 (6=.)(7=.);
recode q13_3_2 (6=.)(7=.);
recode q13_3_3 (6=.)(7=.);
label define q13_3_1label 
            1 "Not at all"
            2 "Once a week"
            3 "2 or 3 days a week"
            4 "4 or 5 days a week"
            5 "Almost everyday";
label value q13_3_1 q13_3_1label;
label var pat "Groups";
label define patlabel 
            1 "(1)"
            2 "(2)"
            3 "(3)"
            4 "(4)"
            5 "(5)"
            6 "(6)";
label value pat patlabel;
recode q04_12 (1 2 3 4 5 =1)(6=0), gen(trapped);
generate correct=0;
replace correct=1 if q06==3;
destring q09, generate(q09a);
generate hokkaidotohoku=0;
label var hokkaidotohoku "Hokkaido&Tohoku";
replace hokkaidotohoku=1 if q09a==01;
replace hokkaidotohoku=1 if q09a==02;
replace hokkaidotohoku=1 if q09a==03;
replace hokkaidotohoku=1 if q09a==04;
replace hokkaidotohoku=1 if q09a==05;
replace hokkaidotohoku=1 if q09a==06;
replace hokkaidotohoku=1 if q09a==07;
generate kantokoshinetsu=0;
label var kantokoshinetsu "Kanto&Koshinetsu";
replace kantokoshinetsu=1 if q09a==08;
replace kantokoshinetsu=1 if q09a==09;
replace kantokoshinetsu=1 if q09a==10;
replace kantokoshinetsu=1 if q09a==11;
replace kantokoshinetsu=1 if q09a==12;
replace kantokoshinetsu=1 if q09a==13;
replace kantokoshinetsu=1 if q09a==14;
replace kantokoshinetsu=1 if q09a==15;
replace kantokoshinetsu=1 if q09a==19;
replace kantokoshinetsu=1 if q09a==20;
generate chubu=0;
label var chubu "Chubu";
replace chubu=1 if q09a==16;
replace chubu=1 if q09a==17;
replace chubu=1 if q09a==18;
replace chubu=1 if q09a==21;
replace chubu=1 if q09a==22;
replace chubu=1 if q09a==23;
replace chubu=1 if q09a==24;
generate kinki=0;
label var kinki "Kinki";
replace kinki=1 if q09a==25;
replace kinki=1 if q09a==26;
replace kinki=1 if q09a==27;
replace kinki=1 if q09a==28;
replace kinki=1 if q09a==29;
replace kinki=1 if q09a==30;
generate chugokushikoku=0;
label var chugokushikoku "Chugoku&Shikoku";
replace chugokushikoku=1 if q09a==31;
replace chugokushikoku=1 if q09a==32;
replace chugokushikoku=1 if q09a==33;
replace chugokushikoku=1 if q09a==34;
replace chugokushikoku=1 if q09a==35;
replace chugokushikoku=1 if q09a==36;
replace chugokushikoku=1 if q09a==37;
replace chugokushikoku=1 if q09a==38;
replace chugokushikoku=1 if q09a==39;
generate kusyuokinawa=0;
label var kusyuokinawa "Kyusyu&Okinawa";
replace kusyuokinawa=1 if q09a>=40;
gen region=0; 
label var region "Region";
replace region=1 if kantokoshinetsu==1;
replace region=2 if chubu==1;
replace region=3 if kinki==1;
replace region=4 if chugokushikoku==1;
replace region=5 if kusyuokinawa==1;
label define regionlabel 
            0 "Hokkaido&Tohoku"
            1 "Kanto&Koshinetsu"
            2 "Chubu"
            3 "Kinki"
            4 "Chugoku&Shikoku"
            5 "Kyusyu&Okinawa";
label value region regionlabel;
recode q02a (1 2 3 4 = 0) (. = 1), gen(dna);
recode q02b (1 2 3 4 = 0) (. = 1), gen(dnb);
recode pat (1 = 1)(3 6 = 2)(2 4 5 = 3), gen(divpat);
gen inattentive=1;
replace inattentive=0 if trapped==0 & duration_exp>=30 ;
generate pat2=0;
replace pat2=1 if pat==2;
generate pat3=0;
replace pat3=1 if pat==3;
generate pat4=0;
replace pat4=1 if pat==4;
generate pat5=0;
replace pat5=1 if pat==5;
generate pat6=0;
replace pat6=1 if pat==6;

/* Declare survery design for dataset */
svyset _n;

/* Save the data for later use */
save Political_Communication_Replication_cleaned.dta, replace;

/*******************************/
/******  Experiment 1 * ********/
/*******************************/

/* Brief description */
sort pat;
by pat: sum q02a q02b;

/* Popularity of the attacker */
/* when the counterpart remains silent */
anova q02a pat if pat==1|pat==2|pat==4;
/* when the counterpart self-promotes */
anova q02a pat if pat==3|pat==5;
anova q02b pat if pat==2|pat==3;
/* when the counterpart denounces */
anova q02b pat if pat==4|pat==5|pat==6;

/* Popularity of the attacked */
/* when he remains silent */
anova q02b pat if pat==1|pat==2|pat==4;
/* when he self-promotes */
anova q02b pat if pat==3|pat==5;
anova q02a pat if pat==2|pat==3;
/* when he denounces */
anova q02a pat if pat==4|pat==5|pat==6;

/* The informativeness of messages */
anova dna divpat;
anova dnb divpat;
 
/* Popularity of the attacker, full sample*/
/* Create a dataset to draw a graph */
collapse (mean) amean=q02a bmean=q02b (sd) asd=q02a bsd=q02b
         (count) an=q02a bn=q02b, by (pat);
stack pat amean asd an pat bmean bsd bn, into (pat mean sd n) clear;
gen hi_q02 = mean + invttail(n-1,0.025)*(sd / sqrt(n));
gen lo_q02 = mean - invttail(n-1,0.025)*(sd / sqrt(n));
gen obs=_n;
recode obs (1 2 4 7 = 1 "Silence") (3 5 8 9 =2 "Self-promote") 
			(6 10 11 12 = 3 "Denounce"), gen(self);
recode obs (1 7 8 10 = 1 "Silence") (2 3 9 11=2 "Self-promote")
			(4 5 6 12 = 3 "Denounce"), gen(other);
recode obs (1=1)(2=2)(4=3)
           (8=5)(3=6)(5=7)
		   (10=9)(11=10)(12=11)(6 7 9=.),gen(agroup);
/* Draw and export a graph */
graph twoway (bar mean agroup) (rcap hi_q02 lo_q02 agroup)
	,legend(off) 
	plotregion(lstyle(none) ilstyle(none) margin(none))
	xscale(range(-0.5 12))
	xmlabel(0 "Attacker         " 1 "S" 2 "Sp" 3 "D" 5 "S" 6 "Sp" 7 "D" 
	9 "S" 10 "Sp" 11 "D", labs(medssmall) labgap(*3) noticks) 
	xlabel(0 "Attaked         " 2 "S" 6 "Sp" 10 "D",labs(medssmall) 
	labgap(*10) noticks) 
	title("Mean support level for the attacker") 
	yscale(range(1 4)) ylabel(1 1.5 2 2.5 3 3.5  4 ) xtitle("");
graph save attackerpop.gph, replace;

/* Popularity of the attacked, full sample */
/* Rewrite a dataset to draw a graph */
recode obs (1=1)(8=2)(10=3)
           (2=5)(3=6)(11=7)
		   (4=9)(5=10)(6=11)(7 9 12=.),gen(tgroup);		   
/* Draw and export a graph */
graph twoway (bar mean tgroup)(rcap hi_q02 lo_q02 tgroup)
	,legend(off) 
	plotregion(lstyle(none) ilstyle(none) margin(none)) 
	xmlabel(0 "Attacker         " 1 "S" 2 "Sp" 3 "D" 5 "S" 6 "Sp" 7 "D" 
	9 "S" 10 "Sp" 11 "D", labs(medssmall) labgap(*3) noticks) 
	xlabel(0 "Attaked         " 2 "S" 6 "Sp" 10 "D",labs(medssmall) 
	labgap(*10) noticks) 
	title("Mean support level for the attacked") 
	yscale(range(1 4)) ylabel(1 1.5 2 2.5 3 3.5 4) xtitle("") ;
graph save targetpop.gph, replace;

graph combine attackerpop.gph targetpop.gph,
	imargin(sides) graphregion(margin(l=1 r=1 b=15 t=15)) title(" ")  
	caption("S: remain silent, Sp: self-promote, D: denounce", 
	box size(small));
graph export bargraph.eps, replace;

use Political_Communication_Replication_cleaned.dta, replace;


/* "Hiding something" */
ttest q03_01 == q03_02 if pat==1;
ttest q03_01 == q03_02 if pat==2;
ttest q03_01 == q03_02 if pat==3;
ttest q03_01 == q03_02 if pat==4;
ttest q03_01 == q03_02 if pat==5;
ttest q03_01 == q03_02 if pat==6;

/* "Acting Legitimately and for Self-defense" */
ttest q03_03 == q03_04 if pat==1;
ttest q03_03 == q03_04 if pat==2;
ttest q03_03 == q03_04 if pat==3;
ttest q03_03 == q03_04 if pat==4;
ttest q03_03 == q03_04 if pat==5;
ttest q03_03 == q03_04 if pat==6;

/* "Will Be More Provocative" */
ttest q03_12 == q03_13 if pat==1;
ttest q03_12 == q03_13 if pat==2;
ttest q03_12 == q03_13 if pat==3;
ttest q03_12 == q03_13 if pat==4;
ttest q03_12 == q03_13 if pat==5;
ttest q03_12 == q03_13 if pat==6;

/*******************************/
/**** Supplemental Analyses ****/
/*******************************/

/* OLS estimation without Entropy Balancing */
/* Country A */
reg q02a pat2 pat3 pat4 pat5 pat6;
coefplot, yline(0) ylabel(-1.0(0.5)2.0,nogrid) drop(_cons) level(95)
	vertical rename(_cons = Constant) msymbol(O) mlcolor(black) color(white) 
	ciopts(lcolor(red) recast(rcap)) 
	title("Simple OLS Estimation", size(medsmall))
	ytitle("Treatment  Effect�� (Country A)") 
	xlabel(1 "SP (v. S)" 2 "SP (v. SP)" 3 "D (v. S)" 4 "D (v. SP)" 5 "D (v. D)", 
	alter labsize(small));
graph save OLS_A, replace;
/* Hypothesis testing */
test pat2=pat4;
test pat3=pat5;
test pat4=pat6;
test pat5=pat6;
/* Country B */
reg q02b pat2 pat3 pat4 pat5 pat6;
coefplot, yline(0) ylabel(-1.0(0.5)2.0,nogrid) drop(_cons) level(95)
	vertical rename(_cons = Constant) msymbol(O) mlcolor(black) color(white) 
	ciopts(lcolor(red) recast(rcap))  
	title("Simple OLS Estimation", size(medsmall))
	ytitle("Treatment  Effect�� (Country B)") 
	xlabel(1 "(SP v.) S" 2 "(SP v.) SP" 3 "(D v.) S" 4 "(D v.) SP" 
	5 "(D v.) D", alter labsize(small));
graph save OLS_B, replace;
/* Hypothesis testing */
test pat3=pat5;
test pat5=pat6;

/* Entropy Balancing */
ebalance q07 q08 q10 q11 kantokoshinetsu chubu kinki chugokushikoku kusyuokinawa, 
	manualtargets(1955 1.53 4.0 3.1 0.3782 0.1420 0.1633 0.0890 0.1139);
svyset [pweight=_webal];
/* Country A */
svy: reg q02a pat2 pat3 pat4 pat5 pat6;
coefplot, yline(0) ylabel(-1.0(0.5)2.0,nogrid) drop(_cons) level(95) vertical 
	rename(_cons = Constant) msymbol(O) mlcolor(black) color(white) 
	ciopts(lcolor(red) recast(rcap)) 
	title("w/ Entropy Balancing", size(medsmall))
	ytitle("Treatment  Effect�� (Country A)") 
	xlabel(1 "SP (v. S)" 2 "SP (v. SP)" 3 "D (v. S)" 4 "D (v. SP)" 
	5 "D (v. D)", alter labsize(small));
graph save Graph_Entropy_Balancing_A, replace;
/* Hypothesis testing */
test pat2=pat4;
test pat3=pat5;
test pat4=pat6;
test pat5=pat6;
 /* Country B */
svy: reg q02b pat2 pat3 pat4 pat5 pat6;
coefplot, yline(0) ylabel(-1.0(0.5)2.0,nogrid) drop(_cons) level(95) vertical 
	rename(_cons = Constant) msymbol(O) mlcolor(black) color(white) 
	ciopts(lcolor(red) recast(rcap)) 
	title("w/ Entropy Balancing", size(medsmall))
	ytitle("Treatment  Effect (Country B)")  
	xlabel(1 "(SP v.) S" 2 "(SP v.) SP" 3 "(D v.) S" 4 "(D v.) SP" 
	5 "(D v.) D", alter labsize(small));
graph save Graph_Entropy_Balancing_B, replace;
/* Hypothesis testing */
test pat3=pat5;
test pat5=pat6;

/* Combined Figures */
graph combine OLS_A.gph OLS_B.gph 
	Graph_Entropy_Balancing_A.gph Graph_Entropy_Balancing_B.gph, 
	imargin(1 1 1 1) graphregion(margin(l=2 r=2)) title(" ")  
	note("The base cateogy is {it:silence} v. {it:silence}.")
	caption("S: remain silent, Sp: self-promote, D: denounce", 
	box size(small));
graph export entropybalancing.eps, replace;

/**************************************/
/****  Experiment 2 in ROK and US  ****/
/**************************************/

/* Load the data: ROK */
use ROK2015June.dta, clear;

/* Recoding variables */
/** Treatments: pat1 C-s, J-s; pat2 C-sp, J-s; pat3 C-s, J-sp; pat4 C-sp, J-sp
pat5 C-d, J-s; pat6 C-s, J-d; pat7 C-d, J-sp; pat8 C-sp, J-d; pat9 C-d, J-d **/
label var q03 "Support China";
recode q03 (-8=.)(-9=.);
label var q04 "Support Japan";
recode q04 (-8=.)(-9=.);
recode q06 (-8=.)(3=.)(1=0 "China")(2=1 "Japan"), gen(sympathy); 
generate pat2=0;
replace pat2=1 if pat==2;
generate pat3=0;
replace pat3=1 if pat==3;
generate pat4=0;
replace pat4=1 if pat==4;
generate pat5=0;
replace pat5=1 if pat==5;
generate pat6=0;
replace pat6=1 if pat==6;
generate pat7=0;
replace pat7=1 if pat==7;
generate pat8=0;
replace pat8=1 if pat==8;
generate pat9=0;
replace pat9=1 if pat==9;
label var q10 "Birth year";
recode q10  (1995/1996 = 0 "under 20")
			(1985/1994 = 1 "20-29")
			(1975/1984 = 2 "30-39")
			(1965/1974 = 3 "40-49")
			(1955/1964 = 4 "50-59")
			(1944/1954 = 5 "60-70"),gen(age);
label var age "Age";
label var q11 "Gender";
label define q11label 
            1 "Male"
            2 "Female";
label value q11 q11label;
label var q13 "Education";
recode q13 (1 2 3 = 0 "Not college graduate")
		   (4 5 6 = 1 "College graduate"),gen(college);
label var college "Education";
destring q14, replace;
recode q14 (13 = .)
		   (1 2 3= 0 "under 2400")
		   (4 5 6 7 = 1 "2400 - 4800")
		   (8/12 = 2 "4800 and more"),gen(income);
label var income "Income (mil won)";
label var q15 "Ideology";
destring q15, replace;
recode q15 (11=.);
recode q15 (0 1 2= 0 "Liberal")
			(3/7  = 1 "Moderate")
			(8 9 10  = 2 "Conservative")
		   (11 = .) ,gen(ideology);
label var ideology "Ideology";
label var pat "Groups";
label define patlabel 
            1 "(1)"
            2 "(2)"
            3 "(3)"
            4 "(4)"
            5 "(5)"
            6 "(6)"
			7 "(7)"
            8 "(8)"
            9 "(9)";
label value pat patlabel;

/* Save the data for later use */
save ROK2015June_recoded.dta, replace;

/* Regression: support for China */ 
reg q03 pat2 pat3 pat4 pat5 pat6 pat7 pat8 pat9;
coefplot, keep(pat2 pat5 pat7 pat9) 
	yline(0) ylabel(-.5(0.5).7,nogrid) drop(_cons) level(95)
	vertical rename(_cons = Constant) msymbol(O) mlcolor(black) color(white) 
	ciopts(lcolor(red) recast(rcap)) 
	title("Support China -- ROK", size(medsmall))
	ytitle("Treatment  Effect��")
	xmlabel(0(1)5 0 "China"  1 "Sp" 2 "D" 3 "D" 4 "D" 5 " "
	, labs(medsmall) labgap(*3) noticks) 
	xlabel(0 "Japan" 1 "S" 2 "S" 3 "Sp" 4 "D", labgap(*10 ) noticks);
graph save ROK_C, replace;

/* Regression: support for Japan */ 
reg q04 pat2 pat3 pat4 pat5 pat6 pat7 pat8 pat9;
coefplot, keep(pat3 pat6 pat8 pat9) 
	yline(0) ylabel(-.5(0.5).7,nogrid) drop(_cons) level(95)
	vertical rename(_cons = Constant) msymbol(O) mlcolor(black) color(white) 
	ciopts(lcolor(red) recast(rcap)) 
	title("Support Japan -- ROK", size(medsmall))
	ytitle("Treatment  Effect")
	xmlabel(0(1)5 0 "Japan"  1 "Sp" 2 "D" 3 "D" 4 "D" 5 " "
	, labs(medsmall) labgap(*3) noticks) 
	xlabel(0 "China" 1 "S" 2 "S" 3 "Sp" 4 "D", labgap(*10 ) noticks);
graph save ROK_J, replace;

/* Load the data: US */
use US2015June.dta, clear;

/* Recoding variables */
label var q03 "Support China";
recode q03 (-8=.)(-9=.);
label var q04 "Support Japan";
recode q04 (-8=.)(-9=.);
recode q06 (-8=.)(3=.)(1=0 "China")(2=1 "Japan"), gen(sympathy); 
generate pat2=0;
replace pat2=1 if pat==2;
generate pat3=0;
replace pat3=1 if pat==3;
generate pat4=0;
replace pat4=1 if pat==4;
generate pat5=0;
replace pat5=1 if pat==5;
generate pat6=0;
replace pat6=1 if pat==6;
generate pat7=0;
replace pat7=1 if pat==7;
generate pat8=0;
replace pat8=1 if pat==8;
generate pat9=0;
replace pat9=1 if pat==9;
label var q10 "Birth year";
recode q10 (1985/1996 = 0 "under 30")
			(1975/1984 = 1 "30-39")
			(1965/1974 = 2 "40-49")
			(1955/1964 = 3 "50-59")
			(1944/1954 = 4 "60-70"),gen(age);
label var age "Age";
label var q11 "Gender";
label define q11label 
            1 "Male"
            2 "Female";
label value q11 q11label;
label var q13 "Education";
recode q13 (1 2 3 = 0 "Not college graduate")
		   (4 5 6 = 1 "College graduate"),gen(college);
label var college "Education";
destring q14, replace;
recode q14 (13 = .)
		   (1 2= 0 "under 26")
		   (3 4  = 1 "26 - 78")
		   (5 6 7 8 9 10 11 12 = 2 "78 and more"),gen(income);
label var income "Income (thousand dollar)";
label var q15 "Ideology";
destring q15, replace;
recode q15 (11=.);
recode q15 (0 1 2= 0 "Liberal")
			(3/7  = 1 "Moderate")
			(8 9 10  = 2 "Conservative")
		   (11 = .) ,gen(ideology);
label var ideology "Ideology";
label var pat "Groups";
label define patlabel 
            1 "(1)"
            2 "(2)"
            3 "(3)"
            4 "(4)"
            5 "(5)"
            6 "(6)"
			7 "(7)"
            8 "(8)"
            9 "(9)";
label value pat patlabel;

/* Save the data for later use */
save US2015June_recoded.dta, replace;

/* Regression: support for China */ 
reg q03 pat2 pat3 pat4 pat5 pat6 pat7 pat8 pat9;
coefplot, keep(pat2 pat5 pat7 pat9) 
	yline(0) ylabel(-.5(0.5).7,nogrid) drop(_cons) level(95)
	vertical rename(_cons = Constant) msymbol(O) mlcolor(black) color(white) 
	ciopts(lcolor(red) recast(rcap)) 
	title("Support China -- US", size(medsmall))
	ytitle("Treatment  Effect")
	xmlabel(0(1)5 0 "China"  1 "Sp" 2 "D" 3 "D" 4 "D" 5 " "
	, labs(medsmall) labgap(*3) noticks) 
	xlabel(0 "Japan" 1 "S" 2 "S" 3 "Sp" 4 "D", labgap(*10 ) noticks);
graph save US_C, replace;

/* Regression: support for Japan */ 
reg q04 pat2 pat3 pat4 pat5 pat6 pat7 pat8 pat9;
coefplot, keep(pat3 pat6 pat8 pat9) 
	yline(0) ylabel(-.5(0.5).7,nogrid) drop(_cons) level(95)
	vertical rename(_cons = Constant) msymbol(O) mlcolor(black) color(white) 
	ciopts(lcolor(red) recast(rcap)) 
	title("Support Japan -- US", size(medsmall))
	ytitle("Treatment  Effect")
	xmlabel(0(1)5 0 "Japan"  1 "Sp" 2 "D" 3 "D" 4 "D" 5 " "
	, labs(medsmall) labgap(*3) noticks) 
	xlabel(0 "China" 1 "S" 2 "S" 3 "Sp" 4 "D", labgap(*10 ) noticks);
graph save US_J, replace; 

/* Export a combined figure */
graph combine ROK_C.gph ROK_J.gph US_C.gph US_J.gph, 
	imargin(1 1 1 1) graphregion(margin(l=2 r=2)) title(" ")  
	note("The base cateogy is {it:silence} v. {it:silence}.")
	caption("S: remain silent, Sp: self-promote, D: denounce", 
	box size(small));
graph export USROK.eps, replace;


/********************************************************************/
/************************   Appendix  *******************************/
/********************************************************************/

/* Reload the data */
use Political_Communication_Replication_cleaned.dta, clear;

/***************************************/
/*** E1: Correct or Incorrect Answer ***/
/***************************************/

/* Subsample by correct or incorrect answer for the original context */
logit correct q07 q08 q10 q11 q12 hokkaidotohoku kantokoshinetsu chubu 
	kinki chugokushikoku kusyuokinawa;
sort correct;
by correct: reg q02a pat2 pat3 pat4 pat5 pat6;
by correct: reg q02b pat2 pat3 pat4 pat5 pat6;

/* Correct answer, Country A */
reg q02a pat2 pat3 pat4 pat5 pat6 if correct==1;
test pat2=pat4;
test pat3=pat5;
test pat4=pat6;
test pat5=pat6;
coefplot, yline(0) ylabel(-1.0(0.5)2.0,nogrid) drop(_cons) level(95) vertical 
	rename(_cons = Constant) msymbol(O) mlcolor(black) color(white) 
	ciopts(lcolor(red) recast(rcap)) 
	title("Correct Answer", size(medsmall))
	ytitle("Treatment  Effect�� (Country A)") 
	xlabel(1 "SP (v. S)" 2 "SP (v. SP)" 3 "D (v. S)" 4 "D (v. SP)" 
	5 "D (v. D)", alter labsize(small));
graph save Graph_Correct_A, replace;
/* Incorrect answer, Country A */
reg q02a pat2 pat3 pat4 pat5 pat6 if correct==0;
test pat2=pat4;
test pat3=pat5;
test pat4=pat6;
test pat5=pat6;
coefplot, yline(0) ylabel(-1.0(0.5)2.0,nogrid) drop(_cons) level(95) vertical 
	rename(_cons = Constant) msymbol(O) mlcolor(black) color(white) 
	ciopts(lcolor(red) recast(rcap)) 
	title("Incorrect Answer", size(medsmall))
	ytitle("Treatment  Effect�� (Country A)") 
	xlabel(1 "SP (v. S)" 2 "SP (v. SP)" 3 "D (v. S)" 4 "D (v. SP)" 
	5 "D (v. D)", alter labsize(small));
graph save Graph_Incorrect_A, replace;
/* Correct answer, Country B */
reg q02b pat2 pat3 pat4 pat5 pat6 if correct==1;
test pat3=pat5;
test pat5=pat6;
coefplot, yline(0) ylabel(-1.0(0.5)2.0,nogrid) drop(_cons) level(95) vertical 
	rename(_cons = Constant) msymbol(O) mlcolor(black) color(white) 
	ciopts(lcolor(red) recast(rcap)) 
	title("Correct Answer", size(medsmall))
	ytitle("Treatment  Effect (Country B)")  
	xlabel(1 "(SP v.) S" 2 "(SP v.) SP" 3 "(D v.) S" 4 "(D v.) SP" 
	5 "(D v.) D", alter labsize(small));
graph save Graph_Correct_B, replace;
/* Inorrect answer, Country B */
reg q02b pat2 pat3 pat4 pat5 pat6 if correct==0;
test pat3=pat5;
test pat5=pat6;
coefplot, yline(0) ylabel(-1.0(0.5)2.0,nogrid) drop(_cons) level(95) vertical 
	rename(_cons = Constant) msymbol(O) mlcolor(black) color(white) 
	ciopts(lcolor(red) recast(rcap))  
	title("Incorrect Answer", size(medsmall))
	ytitle("Treatment  Effect�� (Country B)") 
	xlabel(1 "(SP v.) S" 2 "(SP v.) SP" 3 "(D v.) S" 4 "(D v.) SP" 
	5 "(D v.) D", alter labsize(small));
graph save Graph_Incorrect_B, replace;
/* Combine Figures */
graph combine Graph_Correct_A.gph Graph_Correct_B.gph 
	Graph_Incorrect_A.gph Graph_Incorrect_B.gph, 
	imargin(1 1 1 1) graphregion(margin(l=2 r=2)) title(" ") 
	note("The base cateogy is {it:silence} v. {it:silence}.")
	caption("S: remain silent, Sp: self-promote, D: denounce", 
	box size(small));
graph export correct.eps, replace;


/*******************************/
/***** E1: Balance Table *******/
/*******************************/
/* Full sample (output .tex file) */
tabout age q08 college q11 ideology region pat 
	using balance_a.tex,
	cells(col ci) f(0 0) percent clab(N _) npos(lab) stats(chi2) svy replace  
	style(tex) bt font(bold) topf(top.tex) botf(bottom.tex);

/* Sample without DK (outpu .tex file */
tabout age q08 college q11 ideology region pat if q02a!=.|q02b!=.
	using balance_b.tex,
	cells(col ci) f(0 0) percent clab(N _) npos(lab) stats(chi2) svy replace  
	style(tex) bt font(bold) topf(top.tex) botf(bottom.tex);
	

/**************************************/
/** E1: Robustness Check: Attentives **/
/**************************************/	
	
/* Subsample without inattentive subjects*/
logit inattentive q07 q08 q10 q11 q12 hokkaidotohoku kantokoshinetsu chubu 
	kinki chugokushikoku kusyuokinawa;
sort inattentive;
by inattentive: reg q02a pat2 pat3 pat4 pat5 pat6;
by inattentive: reg q02b pat2 pat3 pat4 pat5 pat6;  

/************************************************/
/** E1: Robustness Check: OLS and Orderd Logit **/
/************************************************/

/* Ordered logit analysis */
reg q02a pat2 pat3 pat4 pat5 pat6;
estimates store m1, title(OLS A);
reg q02b pat2 pat3 pat4 pat5 pat6;
estimates store m2, title(OLS B);
ebalance q07 q08 q10 q11 kantokoshinetsu chubu kinki chugokushikoku kusyuokinawa, 
	manualtargets(1955 1.53 4.0 3.1 0.3782 0.1420 0.1633 0.0890 0.1139);
svyset [pweight=_webal];
svy: reg q02a pat2 pat3 pat4 pat5 pat6;
estimates store m3, title(OLS EB A);
svy: reg q02b pat2 pat3 pat4 pat5 pat6;
estimates store m4, title(OLS EB B);
svy: ologit q02a pat2 pat3 pat4 pat5 pat6;
estimates store m5, title(Ologit EB A);
svy: ologit q02b pat2 pat3 pat4 pat5 pat6;
estimates store m6, title(Ologit EB B);
estout m1 m2 m3 m4 m5 m6 using regtable.tex, cells(b(star fmt(%9.3f)) se(par)) 
	stats(r2 N, star fmt(%9.3f %9.0g) labels(R-squared)) 
	legend label collabels(none) style(tex)
	replace;
	
/****************************************/
/*********** E1: DK responses ***********/
/****************************************/

/* Informativeness of the messages, full sample */
/* Creat a dataset to draw a graph */
use Political_Communication_Replication_cleaned.dta, clear;
collapse (mean) amean=dna bmean=dnb 
		 (sd) asd=dna bsd=dnb (count) an=dna bn=dnb, by(divpat);
stack divpat amean asd an divpat bmean bsd bn, into (divpat mean sd n) clear;
gen hi_dn = mean + invttail(n-1,0.025)*(sd / sqrt(n));
gen lo_dn = mean - invttail(n-1,0.025)*(sd / sqrt(n));
gen obs=_n;
recode obs (4 = 5)(5 = 6)(6 = 7), gen(group);	
graph twoway (bar mean group)(rcap hi_dn lo_dn group), 
	legend(off)
	plotregion(lstyle(none) ilstyle(none) margin(none)) 
	xscale(range(0 8)) 
	xmlabel(1 "S v.S" 2 "Identical" 3 "Divergent" 
	5 "S v. S" 6 "Identical" 7 "Divergent", labs(small) labgap(*3) noticks) 
	xlabel(2 "Support for A" 6 "Support for B",labgap(*10) noticks) 
	ytitle("Percentage of 'Don't Know'") 
	yscale(range(0 0.55)) ylabel(0.1 0.2 0.3 0.4 0.5) xtitle("")
	caption("S: remain silent", box) ;
graph export dn.eps, replace;

	
/**************************************************/
/********* E2: OLS and robustness check  **********/
/**************************************************/

/* ROK */
use ROK2015June_recoded.dta, clear;

reg q03 pat2 pat3 pat4 pat5 pat6 pat7 pat8 pat9;
estimates store rok1, title(OLS CHN);
reg q04 pat2 pat3 pat4 pat5 pat6 pat7 pat8 pat9;
estimates store rok2, title(OLS JPN);
ologit q03 pat2 pat3 pat4 pat5 pat6 pat7 pat8 pat9;
estimates store rok3, title(Ologit CHN);
ologit q04 pat2 pat3 pat4 pat5 pat6 pat7 pat8 pat9;
estimates store rok4, title(Ologit JPN);
reg q03 pat2 pat3 pat4 pat5 pat6 pat7 pat8 pat9 if duration_exp>=30;
estimates store rok5, title(Atten. CHN);
reg q04 pat2 pat3 pat4 pat5 pat6 pat7 pat8 pat9 if duration_exp>=30;
estimates store rok6, title(Atten. JPN);
estout rok1 rok2 rok5 rok6 rok3 rok4 using roktable.tex, 
	cells(b(star fmt(%9.3f)) se(par)) 
	stats(r2 N, star fmt(%9.3f %9.0g) labels(R-squared)) 
	legend label collabels(none) style(tex)
	replace;

/* US */
use US2015June_recoded.dta, clear;

reg q03 pat2 pat3 pat4 pat5 pat6 pat7 pat8 pat9;
estimates store rok1, title(OLS CHN);
reg q04 pat2 pat3 pat4 pat5 pat6 pat7 pat8 pat9;
estimates store rok2, title(OLS JPN);
ologit q03 pat2 pat3 pat4 pat5 pat6 pat7 pat8 pat9;
estimates store rok3, title(Ologit CHN);
ologit q04 pat2 pat3 pat4 pat5 pat6 pat7 pat8 pat9;
estimates store rok4, title(Ologit JPN);
reg q03 pat2 pat3 pat4 pat5 pat6 pat7 pat8 pat9 if duration_exp>=30;
estimates store rok5, title(Atten. CHN);
reg q04 pat2 pat3 pat4 pat5 pat6 pat7 pat8 pat9 if duration_exp>=30;
estimates store rok6, title(Atten. JPN);
estout rok1 rok2 rok5 rok6 rok3 rok4 using ustable.tex, 
	cells(b(star fmt(%9.3f)) se(par)) 
	stats(r2 N, star fmt(%9.3f %9.0g) labels(R-squared)) 
	legend label collabels(none) style(tex)
	replace;
	
/*******************************/
/***** E2: Balance Table *******/
/*******************************/

/* ROK: Full sample (output .tex file) */
use ROK2015June_recoded.dta, clear;
	
svyset _n;

tabout age q11 college income ideology pat 
	using balance_rok.tex,
	cells(col) f(0) percent clab(N ) npos(lab) stats(chi2) svy replace  
	style(tex) bt font(bold) topf(top.tex) botf(bottom.tex);

/* US: Full sample (output .tex file) */
use US2015June_recoded.dta, clear;

svyset _n;

tabout age q11 college income ideology pat 
	using balance_us.tex,
	cells(col) f(0) percent clab(N ) npos(lab) stats(chi2) svy replace  
	style(tex) bt font(bold) topf(top.tex) botf(bottom.tex);


/* Do-file ends here */ 
